perm filename SRIFOR.TXT[PIC,HE] blob sn#677129 filedate 1982-07-06 generic text, type T, neo UTF8
Node: SRI	Up: Top		Previous: Shapeup	Next: CMU

	SRI Picture Format: HEADER/PICTURE/TABLES[/TEXT]

Header: 2048 bytes containing the following fields:
	4 bytes- long integer format ID code
		1000 = old Quam format, no trailer string
		1001 = new Quam format, picture and access tables
			followed by 2 byte short integer giving
			number of bytes of text which follow.
	4 bytes - ignored long integer 0
	2 bytes - X-SIZE, short integer, number of columns (x-direction)
	2 bytes - Y-SIZE, short integer, number of rows (y-direction)
	2 bytes - short integer, bits per pixel
	2 bytes - cryptic Quam options: decimal 513 is known to 
			mean that the block storage is to be in
			32 x 32 blocks.
	4 bytes - long integer, row length of block tables
	4 bytes - long integer, beginning of block tables relative
			to beginning of the whole file
	rest = ignored

PICTURE DATA: Picture data stored in blocked format, with pixel (x,y)
	located at 
		xtab(x) + ytab(y)
	relative to the beginning of the WHOLE FILE. (That is,
	xtab(0) + ytab(0) = 2048.)

BLOCK TABLES: tell how to address pixels, as indicated above.
	XTAB: contains x-size long integers (4 bytes each)
	YTAB: contains y-size long integers (4 bytes each)

TEXT: [OPTIONAL - this exists only if ID code = 1001]
	2 bytes - LENGTH, short integer giving number of bytes of text
	LENGTH bytes - Ascii text



The following is a copy of the file /iu/tb/csrc/shapeup/srihdr.h

/*
**  srihdr.h
**
**  Format of SRI VAX images.
**
**  The full image includes the header, raw data (usually block
**  scanned, bottom to top), some fill, a column offset table,
**  a row offset table, and possibly a string giving
**  the image name.  There may also be additional padding to
**  bring the file length to a multiple of 1024 (512?) bytes.
**  The blocks are generally 1024 bytes (32x32), and padding
**  is used to generate complete blocks.  The column and row
**  address tables are only of lengths ncols and nrows, however.
**  The column table begins in byte tblloc; the row table follows
**  immediately after.  If a string is present (flagged by the
**  format code), the string length is the first short int following
**  the row table.
*/

typedef struct srihdr {
  unsigned long format;			/* SRI magic number */
  unsigned long unused;			/* Unused */
  unsigned short ncols;			/* Raster length */
  unsigned short nrows;			/* Number of lines */
  unsigned short pxlbits;		/* Bits per pixel */
  unsigned short options;		/* Mainsail magic */
  unsigned long blkpxls;		/* Pixels per block */
  unsigned long tblloc;			/* Block table location */
} srihdr;


/* Format codes. */
#define OLDSRIIMG 1000L			/* No name string */
#define NEWSRIIMG 1001L			/* Trailing name string */